import {
  createRouter,
  createWebHashHistory,
  createWebHistory,
} from "vue-router";

import Home from "../views/Home";

const routes = [
  {
    path: "/",
    name: "home",
    component: Home,
    children: [
      {
        path: "/",
        redirect: "page",
      },
      {
        path: "page",
        name: "page",
        component: () => import("../views/Home/Page"),
      },
      {
        path: "goods",
        name: "goods",
        component: () => import("../views/Home/Goods"),
      },
      {
        path: "us",
        name: "us",
        component: () => import("../views/Home/Us"),
      },
      {
        path: "/detail",
        name: "detail",
        component: () => import("../views/Home/Detail/index.vue"),
      },
    ],
  },

  {
    path: "/login",
    name: "login",
    component: () => import("../views/Login/index.vue"),
  },
  {
    path: "/test",
    name: "test",
    component: () => import("../views/Test/index.vue"),
  },
];

const router = createRouter({
  history: createWebHashHistory(), // hash模式：createWebHashHistory，history模式：createWebHistory
  routes,
});

export default router;
